
form = layui.form

form.verify({
  pass: [
    /^[\S]{6,12}$/
    , '密码必须6到12位，且不能出现空格'
  ],
  repass: function (value) {
    if (value !== $('[name="newPwd"]').val()) {
      layer.msg('密码错误');
    }
  }
});



$('#form').on('submit', function (e) {
  e.preventDefault()
  const data = $(this).serialize()

  axios.post('/my/updatepwd', data).then(
    // res => console.log(res)
    ({ data: { status, message } }) => {
      if (status !== 0) {
        return layer.msg(message)
      }

      layer.msg(message, {
        icon: 6,
        time: 1000 //2秒关闭（如果不配置，默认是3秒）
      }, function () {
        window.parent.location.href = '/login.html'
      });


    }
  )

})